package cn.edu.imau.zy.system.controller;

import cn.edu.imau.zy.common.core.controller.BaseController;
import cn.edu.imau.zy.common.core.domain.R;
import cn.edu.imau.zy.common.core.entity.system.SpecialityBase;
import cn.edu.imau.zy.system.service.ISpecialityBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 专业 提供者
 * 
 * @author wyz
 * @date 2020-06-18
 */
@RestController
@RequestMapping("speciality")
public class SpecialityBaseController extends BaseController
{
	
	@Autowired
	private ISpecialityBaseService specialityBaseService;
	
	/**
	 * 查询${tableComment}
	 */
	@GetMapping("get/{specialityCode}")
	public SpecialityBase get(@PathVariable("specialityCode") String specialityCode)
	{
		return specialityBaseService.selectSpecialityBaseById(specialityCode);
		
	}
	
	/**
	 * 查询专业列表-分页
	 */
	@GetMapping("list")
	public R list(SpecialityBase specialityBase)
	{
		startPage();
        return result(specialityBaseService.selectSpecialityBaseList(specialityBase));
	}

	/**
	 * 查询专业列表
	 */
	@GetMapping("jlist")
	public List<SpecialityBase> jList(SpecialityBase specialityBase)
	{
		return specialityBaseService.selectSpecialityBaseList(specialityBase);
	}
	
	
	/**
	 * 新增保存专业
	 */
	@PostMapping("save")
	public R addSave(@RequestBody SpecialityBase specialityBase)
	{		
		return toAjax(specialityBaseService.insertSpecialityBase(specialityBase));
	}

	/**
	 * 修改保存专业
	 */
	@PostMapping("update")
	public R editSave(@RequestBody SpecialityBase specialityBase)
	{		
		return toAjax(specialityBaseService.updateSpecialityBase(specialityBase));
	}
	
	/**
	 * 删除${tableComment}
	 */
	@PostMapping("remove")
	public R remove(String ids)
	{		
		return toAjax(specialityBaseService.deleteSpecialityBaseByIds(ids));
	}
	
}
